"use strict";

require("core-js/modules/es.object.to-string.js");

require("core-js/modules/web.dom-collections.for-each.js");

require("core-js/modules/es.object.keys.js");

require("core-js/modules/es.array.slice.js");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.News = void 0;

require("core-js/modules/es.object.get-own-property-descriptor.js");

var _decorator = require("../decorator");

var _middleware = require("../middleware");

var _tplConfig = require("../tplConfig");

var _news = require("../api/news");

var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _class, _class2;

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }

function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }

var News = (_dec = (0, _decorator.controller)('/news(-*)?(.html)?'), _dec2 = (0, _decorator.get)('/'), _dec3 = (0, _decorator.use)(_middleware.setRenderData), _dec4 = (0, _decorator.get)('/detail/:username/(:id)(.html)?'), _dec5 = (0, _decorator.use)(_news.getDetail), _dec6 = (0, _decorator.use)(_middleware.setRenderData), _dec(_class = (_class2 = /*#__PURE__*/function () {
  function News() {
    _classCallCheck(this, News);
  }

  _createClass(News, [{
    key: "home",
    value: function home(req, res) {
      var renderData = res.renderData; // 多模板配置

      renderData.qqtCustom.tplConfig = _tplConfig.news[renderData.qqtData.detail.tplClass];
      res.render('index', renderData);
    }
  }, {
    key: "detail",
    value: function detail(req, res) {
      var renderData = res.renderData;
      var qqtCustom = renderData.qqtCustom;
      res.render(qqtCustom.render, renderData);
    }
  }]);

  return News;
}(), (_applyDecoratedDescriptor(_class2.prototype, "home", [_dec2, _dec3], Object.getOwnPropertyDescriptor(_class2.prototype, "home"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "detail", [_dec4, _dec5, _dec6], Object.getOwnPropertyDescriptor(_class2.prototype, "detail"), _class2.prototype)), _class2)) || _class);
exports.News = News;